package com.yidu.KuangJia.controller;

import com.yidu.KuangJia.entity.Righty;
import com.yidu.KuangJia.service.RightService;
import com.yidu.KuangJia.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
public class UserController {
    @Autowired
    private RightService rightService;

    @Autowired
    private UserService userService;

    @RequestMapping("/selectUser")
    public String  selectUser(String userName, String userPwd, Model model){
        System.out.println("进入了登录服务类=================================================================================");
        int i = userService.selectUser(userName,userPwd);
        System.out.println("i="+i);
        List<Righty> rightyList = rightService.selectRighty();
        model.addAttribute("rightyList",rightyList);
        if(i==1){
            return "mian";
        }else {
            return "404";
        }
    }

}
